/*******************************************************************************
 * WayStudio GUI Library
 * Developer:Xu Waycell
*******************************************************************************/
#ifndef WIDGETIMPLEMENTATION_HEADER
#define WIDGETIMPLEMENTATION_HEADER

#include <widget.hpp>
#include <map.hpp>
#if defined(WS_X11)
#elif defined(WS_MSWINDOWS)
#include <Windows.h>
#include <CommCtrl.h>
#endif

BEGIN_HEADER

BEGIN_WS_NAMESPACE

struct LOCAL WidgetSpecific
{
	explicit WidgetSpecific(Widget*);
	~WidgetSpecific();

	static Map<Widget*, WidgetSpecific*> SpecificMap;
	static WidgetSpecific* Fetch(Widget*);

	Widget* H_Widget;
//	Widget* H_Parent;
	Layout* H_Layout;
	boolean B_Visiable;
	boolean B_WINDOW;
	integer I_X;
	integer I_Y;
	uinteger I_Height;
	uinteger I_Width;
	uinteger I_MaximumHeight;
	uinteger I_MaximumWidth;
	uinteger I_MinimumHeight;
	uinteger I_MinimumWidth;
	String STR_Title;
#if defined(WS_X11)
#elif defined(WS_MSWINDOWS)
	HWND H_Handle;
	HWND H_Control;
	static Map<HWND, WidgetSpecific*> HandleMap;
#endif
};

class LOCAL Widget::WidgetImplementation
{
public:
	WidgetImplementation();
	~WidgetImplementation();

	void Initial(Widget*);
	void Cleanup();

	void Show();
	void Hide();

	Layout* GetLayout() const;
	void SetLayout(Layout*);

	integer X() const;
	integer Y() const;

	uinteger Width() const;
	uinteger Height() const;

	void Move(integer, integer);
	void Resize(uinteger, uinteger);

	String Title() const;
	void SetTitle(const String&);

#if defined(WS_MSWINDOWS)
	static LRESULT CALLBACK WindowProc(HWND, UINT, WPARAM, LPARAM);
#endif

	WidgetSpecific* H_Specific;
};

END_WS_NAMESPACE

END_HEADER

#endif
